package com.md.EoL;

import java.util.Scanner;

public class EoL1 {
	static boolean h;
	static String a [][]=new String[100][4];
	Scanner scanner=new Scanner(System.in);
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		System.out.println("欢迎来到闽大图书管理系统！");
		System.out.println("1.登录 2.注册");
		int key=scanner.nextInt();
			switch (key) {
			case 1:
				while (true) {
				System.out.println("请输入用户名：");
				String b=scanner.next();
				System.out.println("请输入密码：");
				String c=scanner.next();
				for (int i = 0; i < a.length; i++) {
					if (b.equals(a[i][1]) && c.equals(a[i][2])) {
						h=true;
						break;
					}
				}
				if (h) {
					System.out.println("登录成功！");
					System.out.println(b+",欢迎您使用闽大书籍管理系统！！！");
					break;
				}else {
					System.out.println("输入错误，请重新输入！");
				}
                }
				break;
				
			case 2:
				int index=-1;
				for (int i = 0; i < a.length; i++) {
					if (a[i][0]==null) {
						index=i;
					}
				}
				System.out.println("请输入所属部门：");
				String d=scanner.next();
				System.out.println("请输入用户名：");
				String e=scanner.next();
				System.out.println("请输入密码：");
				String f=scanner.next();
				System.out.println("请输入用户角色：");
				String g=scanner.next();
				System.out.println("注册成功");
				a[index][0]=d;
				a[index][1]=e;
				a[index][2]=f;
				a[index][3]=g;
				EoL2();
				break;


			default:
				break;
			}

	}
	public static void EoL2() {
		Scanner scanner=new Scanner(System.in);
		while (true) {
			System.out.println("请输入用户名：");
			String b=scanner.next();
			System.out.println("请输入密码：");
			String c=scanner.next();
			for (int i = 0; i < a.length; i++) {
				if (b.equals(a[i][1]) && c.equals(a[i][2])) {
					h=true;
					break;
				}
				}
			if (h) {
				System.out.println("登录成功！");
				System.out.println(b+",欢迎您使用闽大书籍管理系统！！！");
				break;
			}else {
				System.out.println("输入错误，请重新输入！");
			}
	}
	}
}
